package com.gopay.checkorder.manager.impl;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gopay.checkorder.dao.BcdlKeyInfoDAO;
import com.gopay.checkorder.domain.BcdlKeyInfo;
import com.gopay.checkorder.manager.BcdlKeyInfoManager;
@Service("bcdlKeyInfoManager")
//此类作废
public class BcdlKeyInfoManagerImpl implements BcdlKeyInfoManager {
	 @Resource(name = "bcdlKeyInfoDAO")
	 private BcdlKeyInfoDAO bcdlKeyInfoDAO;

	@Override
	public boolean checkKeyStatus() {
		if(StringUtils.equals(bcdlKeyInfoDAO.getKeyStatus(), "1")){
			return false;
		}else{
			return true;
		}
	}

	@Override
	@Transactional
	public void changeStatus(String status) {
		BcdlKeyInfo info = bcdlKeyInfoDAO.getBcdlKeyInfo();
		
		if(!StringUtils.equals(info.getKeyStatus(), "1")){
			info.setKeyStatus(status);
			
		}
		bcdlKeyInfoDAO.update(info);
		
	}
}
